//
//  SearchAppViewController.m
//  LimitFree
//
//  Created by lijinghua on 16/3/3.
//  Copyright © 2016年 lijinghua. All rights reserved.
//

#import "SearchAppViewController.h"

@interface SearchAppViewController ()

@end

@implementation SearchAppViewController

- (id)init{
    if (self = [super init]) {
        self.title = @"搜索结果";
        self.navigationStyle = LFNavigationBackStyle;
    }
    return self;
}

- (void)initParamater{
    //从第一页开始，这里初始化为1
    self.page = 1;
    self.category_id = @"0";
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.tableView.tableHeaderView = nil;
}


//拼接搜索使用的Url
- (NSString*)composeServerUrl{
    if ([self.fromType isEqualToString:kLimitType]) {
        //使用限免搜索接口
        NSString *url = [NSString stringWithFormat:SEARCH_LIMIT_URL,self.page,self.keyword];
        return url  ;
    }else if([self.fromType isEqualToString:kReduceType]){
        //降价搜索接口
        return [NSString stringWithFormat:SEARCH_REDUCE_URL,self.page,self.keyword];
    }else if([self.fromType isEqualToString:kFreeType]){
        //免费搜索接口
        return [NSString stringWithFormat:SEARCH_FREE_URL,self.page,self.keyword];
    }else if([self.fromType isEqualToString:kHotType]){
        //热榜搜索接口
        return [NSString stringWithFormat:SEARCH_HOT_URL,self.page,self.keyword];
    }
    
    //走到这里返回空
    return nil;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
